<!DOCTYPE html>
<!--suppress ThymeleafVariablesResolveInspection-->
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8">
    <meta name="viewport"
          content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>layout 后台大布局 - Layui</title>
    <link rel="stylesheet" href="/assets/layui/css/layui.css">
    <script src="/assets/layui/layui.js"></script>
    <script type="text/javascript" src="/assets/js/jquery-1.11.1.js"></script>
</head>
<body class="layui-layout-body">

<div class="layui-layout layui-layout-admin">
    <div class="layui-header">
        <div class="layui-logo">后台管理</div>
        <!-- 头部区域（可配合layui已有的水平导航） -->
        <ul class="layui-nav layui-layout-left">
            <li class="layui-nav-item"><a href="">控制台</a></li>
            <li class="layui-nav-item"><a th:href="@{/doc}" target="_blank">Cookie文档</a>
            </li>
            <li class="layui-nav-item">
                <a href="javascript:;">其它系统</a>
                <dl class="layui-nav-child">
                    <dd><a href="">邮件管理</a></dd>
                    <dd><a href="">消息管理</a></dd>
                    <dd><a href="">授权管理</a></dd>
                </dl>
            </li>
        </ul>
        <ul class="layui-nav layui-layout-right">
            <li class="layui-nav-item">
                <a href="javascript:;">
                    <a th:text="${session.user == null} ? '游客' : ${session.user.name}">username</a>
                </a>
                <dl class="layui-nav-child">
                    <dd><a id="detail" title="detail" href="javascript:void(0);"
                           onclick="addFrame(this, '/dashboard/userDetail')">基本资料</a>
                    </dd>
                    <dd><a href="">安全设置</a></dd>
                </dl>
            </li>
            <li class="layui-nav-item"><a th:href="@{/logout}">退出</a></li>
        </ul>
    </div>

    <div class="layui-side layui-bg-black left-nav">
        <div class="layui-side-scroll side-nav">
            <!-- 左侧导航区域（可配合layui已有的垂直导航） -->
            <ul class="layui-nav layui-nav-tree nav" lay-filter="test">
                <ul class="sub-menu">
                    <li class="layui-nav-item">
                        <a class="" href="javascript:;">用户管理</a>
                        <dl class="layui-nav-child">
                            <dd><a href="javascript:;"><cite>用户列表</cite></a>
                            </dd>
                            <dd><a href="javascript:;">角色管理</a></dd>
                            <dd><a href="javascript:;">权限管理</a></dd>
                        </dl>
                    </li>
                </ul>
                <ul>
                    <li class="layui-nav-item">
                        <a id="swagger" title="Swagger"
                           onclick="addFrame(this, 'swagger-ui.html')">Swagger</a>
                    </li>
                </ul>
                <ul>
                    <li class="layui-nav-item">
                        <a id="dataBase" title="H2-Console"
                           onclick="addFrame(this, '/h2-console')">H2-Console</a>
                    </li>
                </ul>
            </ul>
        </div>
    </div>

    <div class="layui-body">
        <!-- 内容主体区域 -->
        <div class="page-content">
            <div class="layui-tab tab" lay-filter="xbs_tab"
                 lay-allowclose="false">
                <ul class="layui-tab-title">
                    <li>Home</li>
                </ul>
                <div class="layui-tab-content">
                    <div class="layui-tab-item layui-show">
                        <iframe src='/swagger-ui.html' frameborder="0"
                                scrolling="yes" class="x-iframe"
                                style="height: 1200px;width: 100%"></iframe>
                    </div>
                </div>
            </div>
        </div>
        <div class="page-content-bg"></div>
    </div>

    <div class="layui-footer">
        <!-- 底部固定区域 -->
        © layui.com - 底部固定区域
    </div>
</div>
<script>
    //JavaScript代码区域
    var element;
    $(function () {
        layui.use('element', function () {
            element = layui.element;

        });
    });
    function addFrame(obj, url) {
        //新增一个Tab项
        var frame = $("iframe[tab-id=" + obj.id + "]");
        var li = frame.length;
        if (li < 1) {
            element.tabAdd('xbs_tab', {
                title: obj.title,
                content: '<iframe tab-id="' + obj.id + '" frameborder="0" src="' + url + '" scrolling="yes" class="x-iframe" style="height: 1200px;width: 100%"></iframe>',
                id: obj.id
            });
        }
        element.tabChange('xbs_tab', obj.id);
    }
</script>
</body>
</html>
